<?php require ("src/index_cs.php");?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href='css/coolMessage.css' type='text/css' rel='stylesheet' media='screen' />
<title>ASSC Servicios y Soluciones de Colombia</title>
<script language="javaScript" type="text/javascript" src="js/jquery.js"></script>
<script language="javaScript" type="text/javascript" src="js/jquery.simplemodal.js"></script>
<script language="javaScript" type="text/javascript" src="js/coolMessage.js"></script>
<script language="javaScript" type="text/javascript">
	
	function showMessage(show_msg){
		switch(show_msg){
			case 1://error
				coolMessage('error',"<?php echo $_SESSION["msg_cool"];?>");
			break;
			
			case 2://alert
				coolMessage('alert',"<?php echo $_SESSION["msg_cool"];?>");
			break;
			
			case 3://information
				coolMessage('information',"<?php echo $_SESSION["msg_cool"];?>");
			break;
			
			default:
				
			break;
		}
		return false;
	}
	
	function enter(event){
		var enterCodigo = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;   
		if (enterCodigo == 13)
			validateForm();
	}
	
	function validateForm(){		
		f = window.document.form1;
		
		var msg = '';
		
		if(document.getElementById("login").value == "")
			msg += '- The login is required.<br />';
		
		if(document.getElementById("password").value == "")
			msg += '- The password is required.<br />';
		
		
		if( document.getElementById("code") )
			if ( document.getElementById("code").value == '' )
				msg += '- Enter the security code.<br />';
		
		
		if ( msg == '' ){
			f.submit();		
			return true;			
		}
		else{
			coolMessage('alert',msg);
			return false;
		}
	}
	
</script>

</head>
<body onload="javascript: showMessage(<?php echo $show_msg;?>)">
	<div class="logo"><img src="images/logo.png" style="border:0px" height="199" width='402'/></div>
    <div>&nbsp;</div>
    <form name="form1" method="post" action="">
    <table width="99%" class="tbl_login">
        <tr>
            <td width="80%">
                <table  width="100%">
                    <tr>
                        <td colspan="3" class="lbl_title">Authentication</td>
                    </tr>
                    <tr>
                        <td colspan="3">&nbsp;</td>
                    </tr>
                    <tr>
                        <td align="right"><span class="lbl_gray">Usuario:</span></td>
                        <td width="1%">&nbsp;</td>
                        <td><input type="text" name="login" id="login" class="text_grv" size="30" value="<?php echo $_SESSION['loginUsername'];?>" onKeyPress="return enter(event)"/></td>
                    </tr>
                    <tr>
                        <td align="right"><span class="lbl_gray">Contrasena:</span></td>
                        <td>&nbsp;</td>
                        <td><input type="password" name="password" id="password" class="text_grv" size="30" value="" onKeyPress="return enter(event)"/></td>
                    </tr>
                    <?php if ( $_SESSION['intentosLog'] >= 4 ){?>
                    <tr>
                        <td align="right"><span class="lbl_gray">imagen de Seguridad:</span></td>
                        <td>&nbsp;</td>
                        <td valign="top"><img src="includes/generar_imagen_seguridad.php" align="absmiddle" style="padding-left:5px;"/></td>
                    </tr>
                    <tr>
                        <td align="right"><span class="lbl_gray">Entre Codigo de Seguridad:</span></td>
                        <td>&nbsp;</td>
                        <td valign="top"><input name="code" id="code" type="text" class="text_grv" size="12" maxlength="6" onKeyPress="return enter(event)"></td>
                    </tr>
                    <?php }?>
                    <tr><td colspan="3">&nbsp;</td></tr>
                    <tr>
                        <td colspan="3" align="center">
                        	<input type="button" class="button_grv" value="Login" onclick="javascript: validateForm()"/>
                            <input type="button" class="button_grv_cancel" value="Clear" />
						</td>
                    </tr>
                </table>
            </td>
            <td valign="top"><img src="images/logo_small.png" style="border:0px;"/></td>
        </tr>            
    </table>
    </form>
</body>
</html>
<?php include('divscoolmessage.php');?>